﻿using System.ComponentModel.DataAnnotations;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using Web.Models.AnalysisData;

namespace Web.ViewModel.AnalysisData
{
    public class ReportAnalysisListModel
    {
        /// <summary>
        /// 转换数据模型
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static List<ReportAnalysisListModel> ConvertModel(List<ReportAnalysis> model )
        {
            List<ReportAnalysisListModel> list = new List<ReportAnalysisListModel>();
            if (model==null||model.Count==0)
            {
                return list;
            }
            foreach (var m in model)
            {
                list.Add(ConvertModel(m));
            }
            return list;
        }
        /// <summary>
        /// 转换数据模型
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static ReportAnalysisListModel ConvertModel(ReportAnalysis model)
        {
            return new ReportAnalysisListModel
            {
                    Id = model.Id,
                    SailEnd = model.SailEnd ? "航行已结束" : "正在航行中",
                    ShipName = model.ShipName,
                    VoyageNo = model.VoyageNo
            };
            
        }

        /// <summary>
        /// 数据唯一标识
        /// </summary>
        public String Id { get; set; }
        /// <summary>
        ///  船名
        /// </summary>

        public string ShipName { get; set; }

        /// <summary>
        ///  航次号
        /// </summary>
       
        public string VoyageNo { get; set; }

        /// <summary>
        ///  是否航行结束
        /// </summary>
       
        public String SailEnd { get; set; }
        
    }
}
